package com.newsoft.codegen.common;


import java.util.List;
import java.util.Map;

import javax.inject.Inject;



public class BaseServiceImpl<T,S> implements BaseService<T,S> {
	
	@Inject
	protected CommonMapper<T,S> commonMaper;

	public void save(T model) {
		this.commonMaper.insert(model);
		
	}

	public void deleteById(Long id) {
		this.commonMaper.deleteById(id);
		
	}

	public void delete(T model) {
		this.commonMaper.delete(model);
		
	}

	public void update(T model) {
		this.commonMaper.updateById(model);
		
	}

	public List<T> query(T model) {
		return this.commonMaper.query(model);
	}

	public T queryById(Long id) {
		return this.commonMaper.queryById(id);
	}

	public Long count() {
		return this.commonMaper.count();
	}

	public List<T> queryForPage(Map<String, Object> map) {
		return this.commonMaper.queryForPage(map);
	}

	public List<T> queryForPages(S search) {
		return commonMaper.queryForPages(search);
	}

	public Long count(S search) {
		return commonMaper.countSearch(search);
	}

	public void deleteByIds(List<String> ids) {
		commonMaper.deleteByIds(ids);
		
	}
	
	

}
